﻿using System;
using System.Threading;
using System.Threading.Tasks;
using GurLoader.Service.ImgurTaskBuilder;

namespace GurLoader.Service.MessageProcessing
{
    /// <summary>
    ///     Defines functions to handle messages received from a message source such as a mail slot.
    /// </summary>
    public interface MessageProcessingService
    {
        /// <summary>
        ///     Parses and processes the given command returning a task that may be executed by the caller at will.
        /// </summary>
        /// <typeparam name="T">Return type for the task returned.</typeparam>
        /// <param name="command">The string command to parse and process.</param>
        /// <param name="progress">Progress parameter that will be updated as the task operates.</param>
        /// <param name="cancellationToken">Cancellation token to signal a stop to the operation.</param>
        /// <returns>Task that will begin the processing.</returns>
        Task<T> ProcessMessage<T>(string command, IProgress<IDelegatingCommandProgress> progress,
            CancellationToken cancellationToken)
            where T : ImgurProcessResult;
    }
}